<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org"
	xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header">

</head>

<body class="gray-bg">
	<div class="wrapper wrapper-content  animated fadeInRight">
        <div class="row">
            <div class="col-sm-8">
                <div class="ibox">
                    <div class="ibox-content">	
                        <div class="clients-list">
                            <ul class="nav nav-tabs">
                                <li class="active"><a data-toggle="tab" href="#tab-1"><i class="fa fa-user"></i> 备案信息</a>
                                </li>
                                <li class=""><a data-toggle="tab" href="#tab-2"><i class="fa fa-briefcase"></i> 会议信息</a>
                                </li>
                            </ul>
                            <br>
                            <div class="tab-content">
                                <div id="tab-1" class="tab-pane active">
                                    <div class="full-height-scroll">
                                        <div class="col-sm-12 col-sm-offset-0">
                                          <div class="panel panel-primary">
                                          	<div class="panel-heading">
                                          		<i class="fa fa-info-circle"></i> 详情
                                          	</div>
                                          	<div class="panel-body">
									            <div class="wrapper wrapper-content animated fadeInUp">
									                <div class="ibox">
									                    <div class="ibox-content">
									                        <div class="row">
									                            <div class="col-sm-12">
									                                <dl class="dl-horizontal">
									                                    <dt>状态：</dt>
									                                    <dd>
									                                    	<span th:if="${officialEvolve.state == 0}" class="label label-warning">等待备案</span>
									                                    	<span th:if="${officialEvolve.state == 1}" class="label label-primary">备案完成</span>
									                                    </dd>
									                                </dl>
									                            </div>
									                        </div>
									                        
									                        <div class="row">
									                            <div class="col-sm-12">
									                                <dl class="dl-horizontal" th:object="${officialEvolve}">
									                                	
									                                    <dt>&nbsp;</dt><dd>&nbsp;</dd>
									                                    <dt>编号：</dt>
									                                    <dd th:id="officialEvolveId" th:value="*{officialEvolveId}" th:text="*{officialEvolveId}">获取失败</dd>
									                                    
									                                    <dt>&nbsp;</dt><dd>&nbsp;</dd>
									                                    <dt>会议名称：</dt>
									                                    <dd th:text="*{conference.conferenceName}">获取失败</dd>
									                                    <dd hidden="hidden" id="conferenceId" th:text="*{conference.conferenceId}"></dd>
									                                    									                                    
									                                    <dt>&nbsp;</dt><dd th:if="*{state == 1}">&nbsp;</dd>
									                                    <dt>备案名单：</dt>
									                                    <dd style="float:left;margin-left: 10px;" th:each="user,userStat : ${recordUserList}">
																			<a class="label label-info" th:onclick="'javascript:openRight('+${user.userId}+')'" th:text="${user.userName}"></a>
																		</dd>
																		
									                                    <dt th:if="*{state == 0}">&nbsp;</dt><dd th:if="*{state == 0}">&nbsp;</dd>
									                                    <dt th:if="*{state == 0}" style="color: orange;font-size: 20px;">请选择通过名单：</dt>
									                                    <dd th:if="*{state == 0}" style="float:left;margin-left: 10px;margin-top: 5px;" th:each="user,userStat : ${recordUserList}">
									                                    	<input  th:name="${user.userId}" th:id='${userStat.index}' th:value="0" th:names="${user.userName}" type="checkbox" data-size="small">
									                                    </dd>
									                                    
									                                    <dt th:if="*{state == 1}">&nbsp;</dt><dd th:if="*{state == 1}">&nbsp;</dd>
									                                    <dt th:if="*{state == 1}">通过名单：</dt>
									                                    <dd style="float:left; margin-left: 10px;" th:if="${!#lists.isEmpty(recordPassUserList) and officialEvolve.state == 1}"  th:each="user,userStat : ${recordPassUserList}">
																			<a class="label label-primary" th:onclick="'javascript:openRight('+${user.userId}+')'" th:text="${user.userName}"></a>
																		</dd>
																		
																		<dd th:if="${#lists.isEmpty(recordPassUserList) and officialEvolve.state == 1}"><span class="label label-danger">无通过名单</span></dd>
									                                    <dt th:if="*{state == 1}">&nbsp;</dt><dd th:if="*{state == 1}">&nbsp;</dd>
									                                    <dt th:if="*{state == 1}">未通过名单：</dt>
									                                    <dd th:if="${!#lists.isEmpty(recordNotPassUserList)}" style="float:left;margin-left: 10px;"   th:each="user,userStat : ${recordNotPassUserList}">
																			<a class="label label-danger" th:onclick="'javascript:openRight('+${user.userId}+')'" th:text="${user.userName}"></a>
																		</dd>
																		
																		<dd th:if="${#lists.isEmpty(recordNotPassUserList) and officialEvolve.state == 1}"><span class="label label-danger">无未通过名单</span></dd>
									                                    
									                                    <dt>&nbsp;</dt><dd>&nbsp;</dd>
									                                    <dt>正式党员名册：</dt>
									                                    <dd>
									                                    	<a>正式党员名册.xls</a>
									                                    	<a th:href="@{/module/proposer/review(userId=*{officialEvolveId},type=officialRoster,fileName=*{officialRoster})}" class="btn btn-success btn-xs fa fa-edit" th:text="预览"></a>
                                    										<a th:href="@{/module/proposer/download(userId=*{officialEvolveId},type=officialRoster,fileName=*{officialRoster})}" class="btn btn-success btn-xs fa fa-edit" th:text="下载"></a>
									                                    </dd>
									                                    
									                                    <dt>&nbsp;</dt><dd>&nbsp;</dd>
									                                    <dt>提交时间：</dt>
									                                    <dd th:text="*{#dates.format(submitTime,'yyyy-MM-dd HH:mm:ss')}">获取失败</dd>
									                                </dl>
									                            </div>
																
									                        </div>
									                        
									                      </div>
									                        <div class="row">&nbsp;</div>
									                        <div class="row">&nbsp;</div>
									                        <div class="row text-center">
									                        	<a type="button" href="javascript:" onclick="self.location=document.referrer;" class="btn btn-default btn-lg"><i class="fa fa-close"></i>&nbsp;返 回</a>&nbsp;&nbsp;
									                        	<a type="button" href="javascript:" th:if="${officialEvolve.state == 0}" onclick="save()" class="btn btn-primary btn-lg"><i class="fa fa-check"></i>&nbsp;保 存</a>
									                        </div>
									                    </div>
									                </div>
									            </div>
									            <div class="panel-footer">
                                        			面板脚
                                   				</div>
								            </div>
								            
								            
								          </div>
								        </div>
                                </div>
                                
                                <div id="tab-2" class="tab-pane">
                                	o(*￣︶￣*)o 
                                </div>
                                
                            </div>

                        </div>
                    </div>
                </div>
            </div>
            <div class="col-sm-4">
                <div class="ibox ">

                    <div class="ibox-content">
                        <div class="tab-content">
                            <div id="contact-1" class="tab-pane active">
                                <div class="row m-b-lg">
                                    <div class="col-lg-4 text-center">

                                        <div class="m-b-sm">
                                            <img th:src="@{/img/profile.jpg}" alt="image" class="img-circle" style="width: 120px"/>
                                        </div>
                                    </div>
                                    <div class="col-lg-8">
                                        <h3>个人简介</h3>
                                        <p>我从小就树立了一定要加入中国共产党的远大志向，并且一直持续到了今天，热情更是有增无减。
                                        	党的光辉形象就牢牢地铭刻在我的心中，鼓舞着我前进。还记得刚刚迈入学校大门的我，由于对自己的严格要求，在加入少先队时很荣幸地被选为少先队员代表在全校发言，
                                        	那一刻我第一次亲身感受到组织照耀下的光芒，并更加坚定了入党的信念。
                                        </p>
                                        <br>
                                        <button type="button" class="btn btn-primary btn-sm btn-block"><i class="fa fa-envelope"></i> 发送消息
                                        </button>
                                    </div>
                                </div>
                                <div class="client-detail">
                                    <div class="full-height-scroll">

                                        <strong>材料信息</strong>
										<div class="ibox">
						                    <div class="ibox-content">  
						                        
						                        <div class="row">
						                            <div class="col-sm-12">
						                                <dl class="dl-horizontal">
						                                    <dt>&nbsp;</dt><dd>&nbsp;</dd>
						                                    <dt>姓名：</dt>
						                                    <dd th:text="${user.userName}" id="userName"></dd>
						                                     
						                                    <dt>&nbsp;</dt><dd>&nbsp;</dd>
						                                    <dt>年龄：</dt>
						                                    <dd th:text="${user.age}" id="age"></dd>
						                                    
						                                    <dt>&nbsp;</dt><dd>&nbsp;</dd>
						                                    <dt>性别：</dt>
						                                    <dd th:text="${user.sex}" id="sex"></dd>
						                                    
						                                    <dt>&nbsp;</dt><dd>&nbsp;</dd>
						                                    <dt>身份证号码：</dt>
						                                    <dd th:text="${user.idCardNo}" id="idCardNo"></dd>
						                                    
						                                    <dt>&nbsp;</dt><dd>&nbsp;</dd>
						                                    <dt>邮箱：</dt>
						                                    <dd th:text="${user.email}" id="email"></dd>
						                                    
						                                    <dt>&nbsp;</dt><dd>&nbsp;</dd>
						                                    <dt>电话号码：</dt>
						                                    <dd th:text="${user.phonenumber}" id="phonenumber"></dd>
						                                </dl>
						                            </div>
						                            <div class="col-sm-12" id="cluster_info">
						                                <dl class="dl-horizontal">
															<dt>&nbsp;</dt><dd>&nbsp;</dd>
						                                    <dt><a class="text-success">入党志愿书</a></dt>
						                                    <dd id="partyApplicaiton">
							                                    <a class="btn btn-success btn-xs fa fa-edit" th:href='@{/module/proposer/review(userId=${user.userId},type=partyApplicaiton,fileName=${user.proposer.partyApplicaiton})}'>预览</a>&nbsp;&nbsp;
	                                    						<a class="btn btn-success btn-xs fa fa-edit" th:href='@{/module/proposer/download(userId=${user.userId},type=partyApplicaiton,fileName=${user.proposer.partyApplicaiton})}'>下载</a>
						                                    </dd>
						                                    
						                                    <dt>&nbsp;</dt><dd>&nbsp;</dd>
						                                    <dt><a class="text-success">预备党员教育考察登记表</a></dt>
						                                    <dd id="prepareInvestigate">
							                                    <a class="btn btn-success btn-xs fa fa-edit" th:href='@{/module/proposer/review(userId=${user.userId},type=prepareInvestigate,fileName=${user.proposer.prepareInvestigate})}'>预览</a>&nbsp;&nbsp;
	                                    						<a class="btn btn-success btn-xs fa fa-edit" th:href='@{/module/proposer/download(userId=${user.userId},type=prepareInvestigate,fileName=${user.proposer.prepareInvestigate})}'>下载</a>
						                                    </dd>
						                                    
						                                    <dt>&nbsp;</dt><dd>&nbsp;</dd>
						                                    <dt><a class="text-success">转正申请书</a></dt>
						                                    <dd id="officialApplication">
							                                    <a class="btn btn-success btn-xs fa fa-edit" th:href='@{/module/proposer/review(userId=${user.userId},type=officialApplication,fileName=${user.proposer.officialApplication})}'>预览</a>&nbsp;&nbsp;
	                                    						<a class="btn btn-success btn-xs fa fa-edit" th:href='@{/module/proposer/download(userId=${user.userId},type=officialApplication,fileName=${user.proposer.officialApplication})}'>下载</a>
						                                    </dd>
						                                    
						                                    <dt>&nbsp;</dt><dd>&nbsp;</dd>
						                                    <dt><a class="text-success">预备党员转正公示情况登记表</a></dt>
						                                    <dd id="prepareToOfficialPublicity">
							                                    <a class="btn btn-success btn-xs fa fa-edit" th:href='@{/module/proposer/review(userId=${user.userId},type=prepareToOfficialPublicity,fileName=${user.proposer.prepareToofficialPublicity})}'>预览</a>&nbsp;&nbsp;
	                                    						<a class="btn btn-success btn-xs fa fa-edit" th:href='@{/module/proposer/download(userId=${user.userId},type=prepareToOfficialPublicity,fileName=${user.proposer.prepareToofficialPublicity})}'>下载</a>
						                                    </dd>
						                                    
						                                    <dt>&nbsp;</dt><dd>&nbsp;</dd>
						                                    <dt><a class="text-success">思想汇报五</a></dt>
						                                    <dd id="reportFifth">
							                                    <a class="btn btn-success btn-xs fa fa-edit" th:href='@{/module/proposer/review(userId=${user.userId},type=reportFifth,fileName=${user.proposer.reportFifth})}'>预览</a>&nbsp;&nbsp;
	                                    						<a class="btn btn-success btn-xs fa fa-edit" th:href='@{/module/proposer/download(userId=${user.userId},type=reportFifth,fileName=${user.proposer.reportFifth})}'>下载</a>
						                                    </dd>
						                                    
						                                    <dt>&nbsp;</dt><dd>&nbsp;</dd>
						                                    <dt><a class="text-success">思想汇报六</a></dt>
						                                    <dd id="reportSixth">
							                                    <a class="btn btn-success btn-xs fa fa-edit" th:href='@{/module/proposer/review(userId=${user.userId},type=reportSixth,fileName=${user.proposer.reportSixth})}'>预览</a>&nbsp;&nbsp;
	                                    						<a class="btn btn-success btn-xs fa fa-edit" th:href='@{/module/proposer/download(userId=${user.userId},type=reportSixth,fileName=${user.proposer.reportSixth})}'>下载</a>
						                                    </dd>
						                                    
						                                    <dt>&nbsp;</dt><dd>&nbsp;</dd>
						                                    <dt><a class="text-success">思想汇报七</a></dt>
						                                    <dd id="reportSeventh">
							                                    <a class="btn btn-success btn-xs fa fa-edit" th:href='@{/module/proposer/review(userId=${user.userId},type=reportSeventh,fileName=${user.proposer.reportSeventh})}'>预览</a>&nbsp;&nbsp;
	                                    						<a class="btn btn-success btn-xs fa fa-edit" th:href='@{/module/proposer/download(userId=${user.userId},type=reportSeventh,fileName=${user.proposer.reportSeventh})}'>下载</a>
						                                    </dd>
						                                    
						                                    <dt>&nbsp;</dt><dd>&nbsp;</dd>
						                                    <dt><a class="text-success">思想汇报八</a></dt>
						                                    <dd id="reportEighth">
							                                    <a class="btn btn-success btn-xs fa fa-edit" th:href='@{/module/proposer/review(userId=${user.userId},type=reportEighth,fileName=${user.proposer.reportEighth})}'>预览</a>&nbsp;&nbsp;
	                                    						<a class="btn btn-success btn-xs fa fa-edit" th:href='@{/module/proposer/download(userId=${user.userId},type=reportEighth,fileName=${user.proposer.reportEighth})}'>下载</a>
						                                    </dd>
						                                    
						                                </dl>
						                            </div>
						                        </div>
						                        
						                    </div>
						                </div>
                                        
                                        <strong>备注</strong>

                                        <hr/>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
	<div th:include="include :: footer"></div>
	<!-- 甜甜的弹出层 -->
 	<script src="https://cdn.bootcss.com/limonte-sweetalert2/7.21.1/sweetalert2.all.js"></script>
	<script>
		var prefix = "/module/officialEvolve";
		
		function save(){
			//获取所有复选框
			var userList = $('input:checkbox').toArray();
			//通过名单
			var passList = "";
			//未通过名单
			var notPassList = "";
			//循环分别获取通过和未通过名单并组装
			for(var i = 0; i < userList.length; i++){
				if(userList[i].value == '0'){
					notPassList = notPassList + userList[i].name + ',';
				}else if(userList[i].value == '1'){
					passList = passList + userList[i].name + ',';
				}
			}
			submit(passList, notPassList);
		}
		
		//提交名单
		function submit(passList, notPassList){
			$.ajax({
				url: '/module/officialEvolve/saveUserList',
				type: 'post',
				datatype: 'json',
				data: {'successList': passList, 'failList': notPassList, 'officialEvolveId': $('#officialEvolveId').html()
				, 'conferenceId': $('#conferenceId').html()},
				success: function(data){
					if(data.code == 0){
						swal({
							title: '祝贺您',
							text: '备案成功',
							type: 'success'						
						}).then(function(value){
							//返回上一级并刷新
							window.location.href=document.referrer;
						});
					}else{
						swal(
    					"备案失败",
    					"请联系网站管理员",
    					"error"
    				);
					}
				},
				error: function(data){
					swal(
    					"请求失败",
    					"请联系网站管理员",
    					"error"
    				);
				}
			});
		}
		
		//根据复选框个数初始化
		for(var i = 0; i < $('input:checkbox').length; i++){
			var userName = $('#'+ i +'').attr('names');
			$('[id='+ i +']').bootstrapSwitch({
				onText:"通过",
				offText:"未通过",
				onColor:"success",
				offColor:"danger",
				labelText:userName,
				size:"small",
				onSwitchChange:function(event,state){
					if(state==true){
						$(this).val("1");
					}else{
						$(this).val("0");
						
					}
				}
			});
		}
		
		function openRight(userId){
			$.ajax({
				url: prefix + '/selectUserById',
				type: 'post',
				dataType: 'json',
				data: {"userId": userId},
				success: function(data){
					console.log(data);
					var sex = "";
					switch(data.sex){
						case '0':
							sex = '未知';
							break;
						case '1':
							sex = '男';
							break;
						case '2':
							sex = '女';
							break;
					}
					
					$("#sex").html(sex);
					$("#userName").html(data.userName);
					$("#age").html(data.age);
					$("#idCardNo").html(data.idCardNo);
					$("#email").html(data.idCardNo);
					$("#phonenumber").html(data.phonenumber);
					$("#partyApplicaiton").html(
                                    '<a class="btn btn-success btn-xs fa fa-edit" href="/module/proposer/review?userId='+ data.userId +'&type=partyApplicaiton&fileName='+ data.proposer.partyApplicaiton +'">预览</a>&nbsp;&nbsp;' +
                                    '<a class="btn btn-success btn-xs fa fa-edit" href="/module/proposer/download?userId='+ data.userId +'&type=partyApplicaiton&fileName='+ data.proposer.partyApplicaiton +'">下载</a>');
				
					$("#prepareInvestigate").html(
                                    '<a class="btn btn-success btn-xs fa fa-edit" href="/module/proposer/review?userId='+ data.userId +'&type=prepareInvestigate&fileName='+ data.proposer.prepareInvestigate +'">预览</a>&nbsp;&nbsp;' +
                                    '<a class="btn btn-success btn-xs fa fa-edit" href="/module/proposer/download?userId='+ data.userId +'&type=prepareInvestigate&fileName='+ data.proposer.prepareInvestigate +'">下载</a>');
					$("#officialApplication").html(
	                                    '<a class="btn btn-success btn-xs fa fa-edit" href="/module/proposer/review?userId='+ data.userId +'&type=officialApplication&fileName='+ data.proposer.officialApplication +'">预览</a>&nbsp;&nbsp;' +
	                                    '<a class="btn btn-success btn-xs fa fa-edit" href="/module/proposer/download?userId='+ data.userId +'&type=officialApplication&fileName='+ data.proposer.officialApplication +'">下载</a>');
					$("#prepareToOfficialPublicity").html(
	                                    '<a class="btn btn-success btn-xs fa fa-edit" href="/module/proposer/review?userId='+ data.userId +'&type=prepareToOfficialPublicity&fileName='+ data.proposer.prepareToofficialPublicity +'">预览</a>&nbsp;&nbsp;' +
	                                    '<a class="btn btn-success btn-xs fa fa-edit" href="/module/proposer/download?userId='+ data.userId +'&type=prepareToOfficialPublicity&fileName='+ data.proposer.prepareToofficialPublicity +'">下载</a>');
					$("#reportFirst").html(
	                                    '<a class="btn btn-success btn-xs fa fa-edit" href="/module/proposer/review?userId='+ data.userId +'&type=reportFirst&fileName='+ data.proposer.reportFirst +'">预览</a>&nbsp;&nbsp;' +
	                                    '<a class="btn btn-success btn-xs fa fa-edit" href="/module/proposer/download?userId='+ data.userId +'&type=reportFirst&fileName='+ data.proposer.reportFirst +'">下载</a>');
					$("#reportSecond").html(
	                                    '<a class="btn btn-success btn-xs fa fa-edit" href="/module/proposer/review?userId='+ data.userId +'&type=reportSecond&fileName='+ data.proposer.reportSecond +'">预览</a>&nbsp;&nbsp;' +
	                                    '<a class="btn btn-success btn-xs fa fa-edit" href="/module/proposer/download?userId='+ data.userId +'&type=reportSecond&fileName='+ data.proposer.reportSecond +'">下载</a>');
					$("#reportThird").html(
	                                    '<a class="btn btn-success btn-xs fa fa-edit" href="/module/proposer/review?userId='+ data.userId +'&type=reportThird&fileName='+ data.proposer.reportThird +'">预览</a>&nbsp;&nbsp;' +
	                                    '<a class="btn btn-success btn-xs fa fa-edit" href="/module/proposer/download?userId='+ data.userId +'&type=reportThird&fileName='+ data.proposer.reportThird +'">下载</a>');
					$("#reportFourth").html(
	                                    '<a class="btn btn-success btn-xs fa fa-edit" href="/module/proposer/review?userId='+ data.userId +'&type=reportFourth&fileName='+ data.proposer.reportFourth +'">预览</a>&nbsp;&nbsp;' +
	                                    '<a class="btn btn-success btn-xs fa fa-edit" href="/module/proposer/download?userId='+ data.userId +'&type=reportFourth&fileName='+ data.proposer.reportFourth +'">下载</a>');
				},
				fail: function(msg){
					alert("请求失败");
				}
			});
		}
	</script>
</body>
</html>